package com.example.aicloud.utils;

import lombok.Data;

import java.io.Serializable;

/**
 * @Description: 统一返回对象
 * @Author Mr.Tang
 */
@Data
public class Result implements Serializable {
    private int code; // 状态码
    private String msg; // 提示信息
    private Object data; // 返回数据

    public static Result success() {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("success");
        return result;
    }


    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("success");
        result.setData(data);
        return result;
    }

    public static Result fail(String msg) {
        Result result = new Result();
        result.setCode(500);
        result.setMsg(msg);
        return result;
    }


}
